package km.orm.pojo_persistence;
 
import km.orm.pojo.YJ_MEETING_DOC;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.text.DateFormat;
import java.math.BigDecimal;
import com.lonwin.kmorm.baseobject.InstanceIdentity;
import com.lonwin.kmorm.baseobject.PersistenceCapable;
import com.lonwin.kmorm.baseobject.StateManager;
import com.lonwin.kmorm.config.ErMappingConfiguration;
import com.lonwin.kmorm.exception.OrmException;
import com.lonwin.kmorm.state.InstanceType;
import com.lonwin.kmorm.state.PersistenceState;
 
public class Persistence_YJ_MEETING_DOC extends YJ_MEETING_DOC implements PersistenceCapable {
    private StateManager stateManager = new StateManager(PersistenceState.TRANSIENT);
    private InstanceIdentity instanceIdentity = new InstanceIdentity();
    public boolean isNewDeleted() {
        return stateManager.isNewDeleted();
    }
    public boolean isDeleted() {
        return stateManager.isDeleted();
    }
    public boolean isClean() {
        return stateManager.isClean();
    }
    public boolean isDirty() {
        return stateManager.isDirty();
    }
    public boolean isNew() {
        return stateManager.isNew();
    }
    public boolean isTransient() {
        return stateManager.isTransient();
    }
    public boolean isHollow() {
        return stateManager.isHollow();
    }
    public boolean isMainInstance() {
        return this.instanceIdentity.getInstanceType()==InstanceType.MAIN;
    }
    public boolean ifModifyPriKey(ErMappingConfiguration erMappingConfiguration) throws OrmException {
        return this.instanceIdentity.ifModifyPriKey( this, erMappingConfiguration );
    }
    public void makeNewDeleted() {
        stateManager.makeNewDeleted();
    }
    public void makeDeleted() {
        stateManager.makeDeleted();
    }
    public void makeClean() {
        stateManager.makeClean();
    }
    public void makeDirty() {
        stateManager.makeDirty();
    }
    public void makeNew() {
        stateManager.makeNew();
    }
    public void makeTransient() {
        stateManager.makeTransient();
    }
    public void makeHollow() {
        stateManager.makeHollow();
    }
    public InstanceIdentity getInstanceIdentity() {
        return this.instanceIdentity;
    }
    public void generateInstanceIndentity(ErMappingConfiguration erMappingConfiguration) throws OrmException {
        this.instanceIdentity.generateIndentityValue(this, erMappingConfiguration );
    }
    public boolean canMakeDirty() {
        return this.stateManager.isClean();
    }
    public void setMainInstance() {
        this.instanceIdentity.setInstanceType(InstanceType.MAIN);
    }
    public void setSubordinationInstance() {
        this.instanceIdentity.setInstanceType((InstanceType.SUBORDINATION));
    }
    public void setId(String id) {
      super.setId(id);
      if(canMakeDirty()) {
          this.stateManager.makeDirty();
          this.instanceIdentity.setInstanceType(InstanceType.MAIN);
      }
    }
    public void setDoc_nm(String doc_nm) {
      super.setDoc_nm(doc_nm);
      if(canMakeDirty()) {
          this.stateManager.makeDirty();
          this.instanceIdentity.setInstanceType(InstanceType.MAIN);
      }
    }
    public void setDoc_time(Date doc_time) {
      super.setDoc_time(doc_time);
      if(canMakeDirty()) {
          this.stateManager.makeDirty();
          this.instanceIdentity.setInstanceType(InstanceType.MAIN);
      }
    }
    public void setDoc_url(String doc_url) {
      super.setDoc_url(doc_url);
      if(canMakeDirty()) {
          this.stateManager.makeDirty();
          this.instanceIdentity.setInstanceType(InstanceType.MAIN);
      }
    }
    public void setMet_id(String met_id) {
      super.setMet_id(met_id);
      if(canMakeDirty()) {
          this.stateManager.makeDirty();
          this.instanceIdentity.setInstanceType(InstanceType.MAIN);
      }
    }
}
